// 模拟后端动态生成路由
import { MockMethod } from "vite-plugin-mock";

export default [
  {
    url: "/login",
    method: "post",
    response: ({ body }) => {
      if (body.username === "liuchao") {
        return {
          status: 200,
          statusText: "OK",
          data: {
            msg: "登录成功",
            code: 200,
            data: {
              tokenValue: "123456",
              tokenName: "liuchao",
              username: "liuchao",
              phone: "13000000000"
            },
            object: null,
            timestamp: 1626507200000
          }
        };
      } else {
        return {
          status: 200,
          statusText: "OK",
          data: {
            msg: "登录成功",
            code: 200,
            data: {
              tokenValue: "111111",
              tokenName: "admin",
              username: "admin",
              phone: "13588888888"
            },
            object: null,
            timestamp: 1626507200000
          }
        };
      }
    }
  }
] as MockMethod[];
